<style>
    .layui-colla-title {
        background-color: #5FB878;

    }
</style><!-- -->
<form class="layui-form" action=""  method="post" id="editForm">
    <a class="layui-btn layui-btn-normal" lay-submit="" id="delSubmit" lay-filter="del">清空全部扎数</a>
	<table class="layui-table">
		<thead>
			<tr>
				<th>尺码</th>
				{foreach $sizeNames as $k => $v}
                <th>{$v}</th>
                {/foreach}
			</tr>
		</thead>
        <tbody>
			{foreach $clientOrdernums as $kc => $vc}
			<tr>
				<td>{$vc}</td>
                {foreach $sizeNames as $k => $v}
				<td><input type="text" name="zha_num[{$vc}][{$v}]" value="{:isset($ouData[$vc])?arrayGet($ouData[$vc], $v, 0):0}" tabindex="100" lay-verify="required|mimoint" autocomplete="off" placeholder="" class="layui-input height-count"></td>
				{/foreach}
			</tr>
			{/foreach}
		</tbody>
	</table>
    <div class="pop-bottom-bar">
        <a class="layui-btn layui-btn-normal" lay-submit="" id="replaceSubmit" lay-filter="check">确定</a>
        <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
    </div>
</form>

{include file="system@block/layui" /}

<script type="text/javascript">
    layui.use(['table', 'jquery', 'layer', 'form', 'tool'], function() {
    	var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;

        var regFloat = /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/; // 浮点数，小数点后两位
		var regInt = /^\d+$/; // 整数
        form.verify({
        	mimonumber: function(value, item){
        	    if (value=='') return '';
        	    if(! regFloat.test(value)){
        	    	return '只能填写数字';
        	    }
        	},
        	mimoint: function(value, item){
        	    if (value=='') return '';
        	    if(! regInt.test(value)){
        	    	return '只能填写数字';
        	    }
        	}
        });
        form.on('submit(check)', function (data) {
            $("#replaceSubmit").removeClass('layui-btn-normal').addClass('layui-btn-disabled').prop('disabled', true).text('提交中...');
            var formData = data.field;
            $.ajax({
                   type: "POST",
                   url: "{:url('addMcZhaDetail')}",
                   data: formData,
                   dataType:"json",
                   success: function(res){
                        if (res.code == 1) {
                            $('#replaceSubmit').text(res.msg);
                            layer.msg(res.msg, {icon: 1});
                            parent.layer.closeAll()
                            $("#demo1",parent.document).click();
                        } else {
                             layer.msg(res.msg, {icon: 2,anim: 6});
                        }
                   }
                });
            return false;
        });
        
        form.on('submit(del)', function (data) {
            $("#delSubmit").removeClass('layui-btn-normal').addClass('layui-btn-disabled').prop('disabled', true).text('提交中...');
            var formData = data.field;
            $.ajax({
                   type: "POST",
                   url: "{:url('delMcZhaDetail')}",
                   data: formData,
                   dataType:"json",
                   success: function(res){
                        if (res.code == 1) {
                            $('#delSubmit').text(res.msg);
                            layer.msg(res.msg, {icon: 1});
                            window.location.reload();
                            //parent.layer.closeAll()
                            $("#demo1",parent.document).click();
                        } else {
                             layer.msg(res.msg, {icon: 2,anim: 6});
                        }
                   }
                });
            return false;
        });	
    });
</script>